package com.shuihu.liutang.redis;
/*
 * Help Information
 *
 * Create Date:2017/4/16
 *
 * zhangle
 */

import redis.clients.jedis.Pipeline;

public class MatrixFileImporter extends AbsFileImporter {

    String src;
    String dst;
    Double sp;  //相似度

    @Override
    protected String getPrefix() {
        return "MATRIX_";
    }

    @Override
    protected void parseLine(String line) {
        String[] split = line.split("_");
        this.src = split[0];
        split = split[1].split("\t");
        this.dst = split[0];
        this.sp = Double.parseDouble(split[1]);
    }

    @Override
    protected String getKey() {
        return src;
    }

    @Override
    protected void saveRecord(Pipeline pipelined) {
        pipelined.zadd(key, sp, dst);
    }
}
